<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>${requestScope.dynamic.dynamicTitle}</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/dynamicDetail.css">
</head>
<body>
<jsp:include page="../public/header.jsp"/>

<div class="main">
    <%--热门推荐--%>
    <div class="sidebar">
        <span class="title">热门推荐</span>
        <ul>
            <c:forEach var="hot" items="${requestScope.hot.list}">
                <li>
                    <a href="${pageContext.request.contextPath}/dynamic/${hot.dynamicId}">${hot.dynamicTitle}</a>
                </li>
            </c:forEach>
        </ul>
    </div>
    <%--内容--%>
    <div class="left_bar">
        <div class="title">
            <p>
                ${requestScope.dynamicAllVO.dynamic.dynamicTitle}
            </p>
            <span>
                发表日期:
                <fmt:formatDate value="${requestScope.dynamicAllVO.dynamic.dynamicTime}" pattern="yyyy-MM-dd"/>
            </span>
        </div>
        <!-- 内容区域 -->
        <div>
            ${requestScope.dynamicAllVO.dynamic.dynamicContent}
            <div class="end">
                <c:choose>
                    <c:when test="${requestScope.ssdPraise.status == 1 && requestScope.ssdPraise.data.status == 1}">
                        <a href="javascript:void 0;" onclick="likeFunction(this)">已赞(${requestScope.dynamicAllVO.like})</a>
                    </c:when>
                    <c:otherwise>
                        <a href="javascript:void 0;" onclick="likeFunction(this)">赞(${requestScope.dynamicAllVO.like})</a>
                    </c:otherwise>
                </c:choose>
                <a href="javascript:void 0;" onclick="collectFunction(this)">收藏(${requestScope.dynamicAllVO.collect})</a>
            </div>
        </div>
        <%--添加回复--%>
        <div class="addReply">
            <div contenteditable="true"></div>
            <span class="btn" onclick="replyMsg(this,null)">回复</span>
        </div>
        <%--回复的显示区--%>
        <c:forEach var="comment" items="${requestScope.commentList}">
            <div class="reply">
                <img class="headImg" src="${comment.customer.customerHeadImg}" alt="头像">
                <div class="sub">
                    <p class="customerName">
                        <a href="">${comment.customer.customerName}</a>
                    </p>

                    <p class="commentContent">
                        <span>${comment.dynamicComment.customerCommentContent}</span>
                    </p>
                    <p class="spanBox">
                    <span>
                        <fmt:formatDate value="${comment.dynamicComment.customerCommentTime}" pattern="yyyy-MM-dd"/>
                    </span>
                        <span class="answer">
                        <c:if test="${comment.comment != 0}">
                        <span data-type="off" data-count="0"
                              onclick="showComment(this,'${comment.dynamicComment.dynamicCommentId}')">查看所有回复</span>
                        </c:if>
                        <span onclick="addComment(this,'${comment.dynamicComment.dynamicCommentId}')">回复 ${comment.comment}</span>
                    </span>
                    </p>
                </div>
            </div>
        </c:forEach>


        <%--<c:forEach var="secondPart" items="${dcVO.dynamicComment.dynamicCommentVOList}">--%>
        <%--<div class="reply">--%>
        <%--<div class="sub">--%>
        <%--<p class="customerName">--%>
        <%--<a href="">${secondPart.customer.customerName} : </a>--%>
        <%--<span>${secondPart.dynamicComment.customerCommentContent}</span>--%>
        <%--</p>--%>
        <%--<p class="spanBox">--%>
        <%--<span>--%>
        <%--2020-01-01--%>
        <%--<!--<fmt:formatDate value="${dcVO.dynamicComment.customerCommentTime}" pattern="yyyy-MM-dd"/>-->--%>
        <%--</span>--%>
        <%--<span class="answer">--%>
        <%--<!--<c:if test="${dcVO.dynamicComment.comment != 0}">-->--%>
        <%--<span onclick="showComment(this,'${dcVO.dynamicComment.dynamicCommentId}')">查看所有回复</span>--%>
        <%--<!--</c:if>-->--%>
        <%--<span onclick="addComment(this,'${dcVO.dynamicComment.dynamicCommentId}')">回复 ${dcVO.dynamicComment.comment}</span>--%>
        <%--</span>--%>
        <%--</p>--%>
        <%--</div>--%>

        <%--<c:forEach var="secondPart" items="${dcVO.dynamicComment.dynamicCommentVOList}">--%>
        <%--<div class="reply">--%>
        <%--<div class="sub">--%>
        <%--<p class="customerName">--%>
        <%--<a href="">${secondPart.customer.customerName} : </a>--%>
        <%--<span>${secondPart.dynamicComment.customerCommentContent}</span>--%>
        <%--</p>--%>
        <%--</div>--%>
        <%--</div>--%>
        <%--</c:forEach>--%>
        <%--</div>--%>
        <%--</c:forEach>--%>
    </div>

</div>
<script>
    let dynamicId = "${requestScope.dynamicAllVO.dynamic.dynamicId}";
</script>
<script src="${pageContext.request.contextPath}/js/dynamicDetail.js"></script>

<jsp:include page="../public/footer.jsp"/>

</body>
</html>
